package com.robert.dagger2demo;

import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import javax.inject.Inject;

import dagger.android.support.DaggerAppCompatActivity;

public class MainActivity extends DaggerAppCompatActivity {

    private static final String TAG = MainActivity.class.getSimpleName();

    @Inject
    @Model
    String model;

    @Inject
    MainPresenter mMainPresenter;

    @Inject
    void logInjection() {
        Log.i(TAG, "Injecting " + MainActivity.class.getSimpleName());
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        TextView greeting = (TextView) findViewById(R.id.greeting);
        String text = getResources().getString(R.string.welcome, model);
        greeting.setTextSize(15);
        greeting.setText(text + mMainPresenter.hashCode());
    }
}